package com.liuwei.msmall.ware.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;

/**
 * 配置druid数据源
 *
 * @author llww
 * @date 2021/2/23 9:30
 */
@EnableTransactionManagement //开启事务
@Configuration
@MapperScan("com.liuwei.msmall.ware.dao")
public class DruidConfig {


    @ConfigurationProperties(prefix = "spring.datasource.druid")
    @Bean
    public DataSource druid() {
        return new DruidDataSource();
    }

}
